package com.xing.dao;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.xing.model.EmployeeInfo;

@Repository
public class EmployeeDao {

	@Resource
	private BaseDao baseDao;

	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}
	
//	public void addSubsidiary(SubsidiaryInfo info) {
//		
//		baseDao.getHibernateTemplate().save(info);
//	}
//	
//	public void updateSubsidiary(SubsidiaryInfo info) {
//		
//		baseDao.getHibernateTemplate().saveOrUpdate(info);
//	}
//	
//	public void deleteSubsidiary(List<Integer> idList) {
//		String hql = "delete from SubsidiaryInfo where subsidiaryId in (:subsidiaryId)";
//		
//		List<ParamModel> paramModelList = new ArrayList<ParamModel>();
//		paramModelList.add(new ParamModel("subsidiaryId", idList));
//		
//		baseDao.updateByHql(hql, paramModelList);
//	}
	
	public List<EmployeeInfo> getList() {
		String hql = "from EmployeeInfo c order by c.employeeName";
		
		return (List<EmployeeInfo>) baseDao.getList(hql);
//		
//		List<EmployeeInfo> list = new ArrayList<EmployeeInfo>();
//		
//		for (int i = 0; i < 10; i++) {
//			EmployeeInfo info = new EmployeeInfo();
//			info.setEmployeeId(i + 1);
//			info.setEmployeeName("Employ " + (i+1));
//			
//			list.add(info);
//		}
		
//		return list;
	}
	
//	public SubsidiaryInfo getSubsidiaryInfo(int id) {
//		
//		return (SubsidiaryInfo) baseDao.getHibernateTemplate().get(SubsidiaryInfo.class, id);
//	}
}
